/*    */ package com.zimbra.cs.service.mail;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import com.zimbra.cs.mailbox.ContactRankings;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class RankingAction
/*    */   extends MailDocumentHandler
/*    */ {
/*    */   public static final String OP_RESET = "reset";
/*    */   public static final String OP_DELETE = "delete";
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 35 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 36 */     Account account = getRequestedAccount(zsc);
/* 37 */     if (account == null)
/* 38 */       throw AccountServiceException.NO_SUCH_ACCOUNT("");
/* 39 */     Element action = request.getElement("action");
/* 40 */     String operation = action.getAttribute("op").toLowerCase();
/* 41 */     if (operation.equals("reset")) {
/* 42 */       ContactRankings.reset(account.getId());
/* 43 */     } else if (operation.equals("delete")) {
/* 44 */       String email = action.getAttribute("email");
/* 45 */       ContactRankings.remove(account.getId(), email);
/*    */     }
/* 47 */     return zsc.createElement(MailConstants.RANKING_ACTION_RESPONSE);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/RankingAction.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */